fix: recreate pnpm symlinks as junctions on Windows in copyTracedFiles#1185
Open
joshua92y wants to merge 1 commit into
Open
fix: recreate pnpm symlinks as junctions on Windows in copyTracedFiles#1185joshua92y wants to merge 1 commit into
joshua92y wants to merge 1 commit into
Conversation
…yTracedFiles On Windows, recreating a pnpm directory symlink from the raw readlinkSync value produces a file-type symlink when the target does not exist yet (Node autodetects the type and falls back to "file"), which Windows cannot traverse as a directory. esbuild then fails with "Cannot read directory ...: Access is denied" / could not resolve errors. Create a junction instead, with the raw target resolved against the destination parent directory - semantically identical to what the relative symlink means on Linux. Junctions only apply to directories, need no admin rights or Developer Mode, and resolve lazily once the target is populated. Fixes opennextjs#1184 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: fb13e04 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1184
On Windows,
copyTracedFilesrecreates pnpm directory symlinks from the rawreadlinkSyncvalue. Per the Node docs,symlinkSyncwithout atypeautodetects from the target — and falls back to'file'when the target does not exist. Since entries are copied in traversal order, the relative target inside the output mirror frequently does not exist yet at link-creation time, producing a file-type symlink pointing at a directory. Windows cannot traverse those, so esbuild later fails withCannot read directory ...: Access is denied/Could not resolve "styled-jsx".Change
On
win32, recreate the link as a junction whose target is the raw symlink value resolved against the destination's parent directory — semantically identical to what the relative symlink means on Linux (it points into the mirrored output structure):\\?\-prefixed absolute targets (as returned byreadlinkSyncfor junctions) are handledNon-Windows behavior is unchanged.
Validation
packages/tests-unit/tests/build/copyTracedFiles.test.ts— 9/9 passingpnpm --filter @opennextjs/aws build(tsc) andbiome checkpass@opennextjs/aws4.0.2 on three real Next.js 16 apps on Windows 11 (pnpmnodeLinker: isolated×2,hoisted×1): builds reach "Worker saved" with no esbuild errors, and all three are deployed to Cloudflare Workers serving HTTP 200 in production.A changeset (patch) is included.
🤖 Generated with Claude Code